import request from '@/utils/request'
// 从配置中获取业务的地址
import { baseUrlConfig } from '@/config/config'

export const basePath = baseUrlConfig.processBaseUrl

// 获取分页列表
export const greyPageList = (data: any) => {
  return request({
    url: basePath + '/quality/scheduleScheme/find/page',
    method: 'post',
    data
  })
}
// 获取分组
export const groupList = (createDept: any) => {
  return request({
    url: basePath + `/quality/scheduleGroup/getGroup`,
    method: 'post',
    data:{
      createDept:createDept,
      order:[{
          column:'sort_no',
          method:'asc'
        }]
    }
  })
}
// 获取人员
export const staffList = (data: any) => {
  return request({
    url: basePath + `/quality/employee/find`,
    method: 'post',
    data
  })
}
// 获取班次
export const findSchedule = (data: any) => {
  return request({
    url: basePath + `/quality/scheduleClass/find`,
    method: 'post',
    data
  })
}
// 新增排班
export const addScheduleScheme = (data: any) => {
  return request({
    url: basePath + `/quality/scheduleScheme/add`,
    method: 'post',
    data
  })
}
//第二版
export const addScheduleSchemeV1 = (data: any) => {
  return request({
    url: basePath + `//quality/scheduleScheme/add`,
    method: 'post',
    data
  })
}

//修改
export const updateScheduleScheme = (data: any) => {
  return request({
    url: basePath + `/quality/scheduleScheme/update`,
    method: 'put',
    data
  })
}
export const updateScheduleSchemeV1 = (data: any) => {
  return request({
    url: basePath + `/quality/scheduleScheme/update`,
    method: 'put',
    data
  })
}
//获取排班基础信息详细信息
export const detailScheduleScheme = (id: any) => {
  return request({
    url: basePath + `/quality/scheduleScheme/${id}`,
    method: 'get',
  })
}
export const detailScheduleSchemeV1 = (id: any) => {
  return request({
    url: basePath + `/quality/scheduleScheme/${id}`,
    method: 'get',
  })
}
//修改排班状态
export const updateStatus = (data: any) => {
  return request({
    url: basePath + `/quality/scheduleScheme/updateStatus`,
    method: 'put',
    data
  })
}
//查看是否可以新增排班
export const isSchedule = (status: any, schemeDate: any, schedulerORteamId: any,) => {
  return request({
    url: basePath + `/quality/scheduleScheme/isSchedule?status=${status}&schemeDate=${schemeDate}&schedulerORteamId=${schedulerORteamId}`,
    method: 'get',
  })
}
//获取代班人是否有班次
export const getEmpNot = (day: any, createDept: any) => {
  return request({
    url: basePath + `/quality/employee/getEmpNot`,
    method: 'post',
    data: {
      day: day,
      createDept: createDept
    }
  })
}
//获取被代班人
export const findEmployee = (data: any) => {
  return request({
    url: basePath + `/quality/employee/find`,
    method: 'post',
    data
  })
}
//获取节假日
export const getHoliday = (schemeDate: any) => {
  return request({
    url: basePath + `/quality/scheduleScheme/getHoliday?schemeDate=${schemeDate}`,
    method: 'get',
  })
}

export const scheduleSchemeDel = (data: any) => {
  return request({
    url: basePath + `/quality/scheduleScheme/deleteDetail`,
    method: 'delete',
    data
  })
}
